#ifndef F65230BF_5623_4986_960F_0DADA4B252D6
#define F65230BF_5623_4986_960F_0DADA4B252D6

#endif /* F65230BF_5623_4986_960F_0DADA4B252D6 */

#pragma once

#include <iostream>
#include <string>

using namespace std;

string opers = "+-*/%";

enum
{
    Div_Zero = 1,
    Mod_Zero,
    Un_Know
};

class Task
{
public:
    Task(int x, int y, char op)
        : data1_(x), data2_(y), oper_(op), result_(0), exitcode_(0)
    {
    }

    void Run()
    {
        switch (oper_)
        {
        case '+':
            result_ = data1_ + data2_;
            break;
        case '-':
            result_ = data1_ - data2_;
            break;
        case '*':
            result_ = data1_ * data2_;
            break;
        case '/':
            {
                if (data2_ == 0)
                    exitcode_ = Div_Zero;
                else
                    result_ = data1_ / data2_;
            }
            break;
        case '%':
            {
                if(data2_ == 0)
                    exitcode_ = Mod_Zero;
                else
                    result_ = data1_  % data2_;
            }
            break;
        default:
            exitcode_ = Un_Know;
            break;
        }
    }

    void operator ()()
    {
        Run();
    }

    string GetResult()
    {
        string retr = to_string(data1_) + oper_ + to_string(data2_) 
                + "=" + to_string(result_) 
                + "[exitcode: " + to_string(exitcode_) + "]";
        return retr;
    }

    string GetTask()
    {
        string rett = to_string(data1_) + oper_ + to_string(data2_) + "=?";
        return rett;
    }

    ~Task()
    {
    }

private:
    int data1_;
    int data2_;
    char oper_;

    int result_;
    int exitcode_;
};